import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.SimpleChannelInboundHandler;
import org.newbee.proto.OrderProtocol;

import java.util.Date;

/**
 * Created by iss on 17/6/6.
 */
public class NettyTestServerHandler2 extends SimpleChannelInboundHandler<OrderProtocol.Order> {
    @Override
    protected void channelRead0(ChannelHandlerContext channelHandlerContext, OrderProtocol.Order order) throws Exception {
        System.out.println(order);
        System.out.println(order.getPaymentsList().get(0));
        channelHandlerContext.channel().write(order);
    }

    @Override
    public void channelReadComplete(ChannelHandlerContext ctx) throws Exception {
        System.out.println(new Date());
        System.out.println("channelReadComplete");
        Thread.sleep(3000);
        ctx.channel().flush();
    }
}
